Skip to main content

Overview

All Steam API responses are parsed into strongly-typed Pydantic models for validation and type safety. These models match Steam’s Market API endpoint response contracts.

PriceOverviewData

Response model for /priceoverview endpoint.
from src.dataClasses import PriceOverviewData

Fields

success
bool
required
Whether the API call succeeded
lowest_price
str | None
Current lowest listing price (formatted string, e.g., “$10.50”)
median_price
str | None
Recent median sale price (formatted string, e.g., “$10.75”)
volume
str | None
Recent sales volume (formatted string, e.g., “1,234”)

Example

data = PriceOverviewData(
    success=True,
    lowest_price="$10.50",
    median_price="$10.75",
    volume="1,234"
)

print(f"Lowest: {data.lowest_price}")
print(f"Median: {data.median_price}")
print(f"Volume: {data.volume}")
API Response Example:
{
  "success": true,
  "lowest_price": "$10.50",
  "median_price": "$10.75",
  "volume": "1,234"
}

OrderBookEntry

Nested model representing a single order book entry (buy or sell).
from src.dataClasses import OrderBookEntry

Fields

price
str
required
Price as formatted string (e.g., “10.50”)
quantity
str
required
Number of orders at this price level (API returns string, not int)

Example

entry = OrderBookEntry(
    price="10.50",
    quantity="42"
)

print(f"Price: {entry.price}, Quantity: {entry.quantity}")

OrdersHistogramData

Response model for /itemordershistogram endpoint.
from src.dataClasses import OrdersHistogramData

Fields

success
int | bool
required
Whether the API call succeeded (Steam returns 1 for true)
sell_order_count
int | str | None
Total number of sell orders
sell_order_price
str | None
Lowest sell order price
sell_order_table
List[OrderBookEntry] | None
List of sell order book entries
buy_order_count
int | str | None
Total number of buy orders
buy_order_price
str | None
Highest buy order price
buy_order_table
List[OrderBookEntry] | None
List of buy order book entries
highest_buy_order
str | None
Highest buy order price string
lowest_sell_order
str | None
Lowest sell order price string
buy_order_graph
List
default:"[]"
Graph data for buy orders
sell_order_graph
List
default:"[]"
Graph data for sell orders
graph_max_y
int | None
Maximum Y value for graph
graph_min_x
float | None
Minimum X value for graph
graph_max_x
float | None
Maximum X value for graph
price_prefix
str
default:""
Currency prefix (e.g., ”$”)
price_suffix
str
default:""
Currency suffix (e.g., ”€“)

Example

data = OrdersHistogramData(
    success=1,
    buy_order_count=1234,
    buy_order_price="10.45",
    sell_order_count=567,
    sell_order_price="10.55",
    highest_buy_order="10.45",
    lowest_sell_order="10.55",
    price_prefix="$"
)

print(f"Buy orders: {data.buy_order_count} at {data.highest_buy_order}")
print(f"Sell orders: {data.sell_order_count} at {data.lowest_sell_order}")
print(f"Spread: {float(data.lowest_sell_order) - float(data.highest_buy_order):.2f}")
API Response Example:
{
  "success": 1,
  "sell_order_count": 567,
  "sell_order_price": "10.55",
  "buy_order_count": 1234,
  "buy_order_price": "10.45",
  "highest_buy_order": "10.45",
  "lowest_sell_order": "10.55",
  "price_prefix": "$"
}

ActivityEntry

Parsed model representing a single trade activity event.
from src.dataClasses import ActivityEntry
Note: This is NOT returned by the API - it’s created by parsing the HTML strings in the activity array.

Fields

price
str | None
Trade price as string (e.g., “0.85”)
currency
str | None
ISO currency code (e.g., “EUR”, “USD”)
action
str | None
Activity action (e.g., “Purchased”, “Listed”)
timestamp
datetime | None
When the activity occurred
raw_html
str
required
Original HTML string from API

Example

entry = ActivityEntry(
    price="10.50",
    currency="USD",
    action="Purchased",
    timestamp=datetime(2024, 3, 15, 14, 30),
    raw_html="<div>Purchased at $10.50</div>"
)

print(f"{entry.timestamp}: {entry.action} at {entry.price} {entry.currency}")

OrdersActivityData

Response model for /itemordersactivity endpoint.
from src.dataClasses import OrdersActivityData

Fields

success
int | bool
required
Whether the API call succeeded (Steam returns 1 for true)
activity
List[str]
default:"[]"
List of HTML strings containing trade activity
timestamp
int
required
Unix timestamp of the response
parsed_activities
List[ActivityEntry] | None
Parsed activity entries (automatically populated by SteamAPIClient)

Example

data = OrdersActivityData(
    success=1,
    activity=[
        "<div>Purchased at $10.50</div>",
        "<div>Listed at $10.75</div>"
    ],
    timestamp=1710513000
)

# parsed_activities is automatically populated by the client
for activity in data.parsed_activities:
    print(f"{activity.action}: {activity.price}")
API Response Example:
{
  "success": 1,
  "activity": [
    "<div>Purchased at $10.50</div>",
    "<div>Listed at $10.75</div>"
  ],
  "timestamp": 1710513000
}

PriceHistoryPoint

Parsed model representing a single price history data point.
from src.dataClasses import PriceHistoryPoint
Note: This is NOT returned by the API - it’s created by parsing the arrays in the prices field.

Fields

date_string
str
required
Date as string (e.g., “Jul 02 2014 01: +0”)
price
float
required
Median price at this time
volume
str
required
Trading volume (as string from API)

Example

point = PriceHistoryPoint(
    date_string="Jul 02 2014 01: +0",
    price=10.50,
    volume="1234"
)

print(f"{point.date_string}: ${point.price} (volume: {point.volume})")

PriceHistoryData

Response model for /pricehistory endpoint.
from src.dataClasses import PriceHistoryData

Fields

success
bool
required
Whether the API call succeeded
price_prefix
str
default:""
Currency prefix (e.g., ”$”)
price_suffix
str
default:""
Currency suffix (e.g., ”€”)
prices
List[List]
default:"[]"
Array of [date_string, price_float, volume_string] arrays

Example

data = PriceHistoryData(
    success=True,
    price_prefix="$",
    prices=[
        ["Jul 02 2014 01: +0", 10.50, "1234"],
        ["Jul 03 2014 01: +0", 10.75, "567"],
        ["Jul 04 2014 01: +0", 10.60, "890"]
    ]
)

for entry in data.prices:
    date_str, price, volume = entry
    print(f"{date_str}: {data.price_prefix}{price} (volume: {volume})")
API Response Example:
{
  "success": true,
  "price_prefix": "$",
  "price_suffix": "",
  "prices": [
    ["Jul 02 2014 01: +0", 10.50, "1234"],
    ["Jul 03 2014 01: +0", 10.75, "567"],
    ["Jul 04 2014 01: +0", 10.60, "890"]
  ]
}

Model Hierarchy

PriceOverviewData
  └─ (flat structure)

OrdersHistogramData
  └─ sell_order_table: List[OrderBookEntry]
  └─ buy_order_table: List[OrderBookEntry]

OrdersActivityData
  └─ parsed_activities: List[ActivityEntry]

PriceHistoryData
  └─ prices: List[List] (can be parsed into PriceHistoryPoint)

Type Safety

All models use Pydantic for:
  • Automatic validation: Invalid data raises ValidationError
  • Type coercion: "1"True, 11.0, etc.
  • Optional fields: None allowed where specified
  • Default values: Empty lists/strings where appropriate
  • Nested models: Automatic parsing of nested structures

Usage with SteamAPIClient

The SteamAPIClient automatically parses responses into these models:
async with SteamAPIClient(rate_limiter=limiter) as client:
    # Returns PriceOverviewData
    overview = await client.fetch_price_overview(
        appid=730,
        market_hash_name="AK-47 | Redline (Field-Tested)"
    )
    
    # Returns OrdersHistogramData
    histogram = await client.fetch_orders_histogram(
        appid=730,
        item_nameid=176059193,
        currency=1
    )
    
    # Returns OrdersActivityData (with parsed_activities)
    activity = await client.fetch_orders_activity(
        item_nameid=176059193
    )
    
    # Returns PriceHistoryData
    history = await client.fetch_price_history(
        appid=730,
        market_hash_name="AK-47 | Redline (Field-Tested)"
    )

Validation Errors

If the API returns unexpected data, Pydantic raises ValidationError:
from pydantic import ValidationError

try:
    data = PriceOverviewData(**api_response)
except ValidationError as e:
    print(f"Invalid response: {e}")
    # Handle validation error